package com.liusuai.yixian.WebSocket;

/*mapper接口*/

//1 @Mapper将UserDao声明为一个Mapper接口
//2 @Results是结果映射列表，@Result中property是User类的属性名，colomn是数据库表的字段名
//3 @Select, @Insert 分别代表了执行的真实SQL

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface MessageMapper {

    //查询所有待接收的信息
    @Select("select * from un_send_message where toid=#{toId} ")
    List<UnSendMsgBean> getUnSendMessageById(@Param("toId") String toId);

    @Insert("insert into un_send_message(fromId,toId,type,data) " +
            "value(#{fromId},#{toId},#{type},#{data})")
    void insertUnSend(UnSendMsgBean unSendMessage);

    //删除当当事人 所有未接到的信息
    @Delete("DELETE FROM un_send_message WHERE toId=#{toId}")
    void delUnSendMsgs(@Param("toId") String toId);
}